package source.module.carousel;

import source.kernel.Container;
import source.kernel.serialization.json.Json;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author Hai Thomson
 */
public class Carousel_application {
	public static void run() throws IOException, SQLException {
		String hostid = Container.app().request.getParameter("hostid");
		if (hostid == null  && hostid.equals("")) {
			return;
		}

		List applications = ((source.table.applications) Container.table("applications")).fetchApplicationsByHostid(hostid);

		Container.app().response.getWriter().print(Json.toJson(applications));
		Container.app().response.getWriter().flush();
	}
}
